import Vue from 'vue'
import App from './App'
import { router } from '@/router'
import vuex from 'vuex'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import store from './store'
import './icons' // icon
import _ from 'lodash'
import axios from 'axios'
// bus总线
import Bus from '@/utils/bus'
import '@/styles/index.scss' // global css
// 浏览器样式初始化
import 'normalize.css'
// 引入公用样式
import './../static/css/xf-page.css'
import './../static/css/xf-public.css'
// 引入字体库
import './../static/css/font/iconfont.css'
import './../static/css/font-awesome/css/font-awesome.css'
// cytoscape相关文件
import cytoscape from 'cytoscape'
import dagre from 'cytoscape-dagre'
import cola from 'cytoscape-cola'
import './../static/js/relation/cytoscape-cose-bilkent'
import './../static/js/relation/cytoscape-euler'
import './../static/js/relation/jquery.ui'
import './../static/js/relation/DateSlider'
import './../static/js/scrollbar/perfect-scrollbar.min.css'
import './../static/js/scrollbar/perfect-scrollbar.min.js'
import './../static/js/public'
import './../static/css/relation.css'
import './../static/css/box.css'
import './../static/js/relation/ctxmenu.js'
import './../static/js/relation/menu.all.css'
Vue.use(ElementUI)
Vue.use(vuex)

cytoscape.use(dagre)
cytoscape.use(cola)
var panzoom = require('cytoscape-panzoom')
var navigator = require('cytoscape-navigator')
panzoom(cytoscape)
navigator(cytoscape)
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
    el: '#app',
    data: {
        Bus
    },
    router,
    store,
    mounted () {
        this.getConfigJson()
    },
    methods: {
        getConfigJson () {
            if (process.env.NODE_ENV === 'production') {
                axios.get('serverconfig.json').then((result) => {
                    console.log('result', result)
                    Vue.prototype.BASE_URL = result.data.BASE_URL
                    Vue.prototype.LOGIN_URL = result.data.LOGIN_URL
                    Vue.prototype.DSR_URL = result.data.DSR_URL
                    Vue.prototype.GOOGLE_MAP = result.data.GOOGLE_MAP
                    console.log('GOOGLE_MAP', Vue.prototype.GOOGLE_MAP)
                }).catch((error) => { console.log(error) })
            }
        }
    },
    components: { App },
    template: '<App/>'
})
